package com.sinux.generality.provider.pay.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sinux.generality.provider.pay.entity.GptPayOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 支付订单表 Mapper 接口
 * </p>
 *
 * @author sinux
 * @since 2023-05-05
 */
public interface GptPayOrderMapper extends BaseMapper<GptPayOrder> {
    /****
     * getPayPrepayByBussinessId 根据业务订单id查询支付成功的订单
     * @author lhz
     * @param businessId 业务订单id
     * @return com.chuanlian.pojo.pay.GptPayPrepayMapper
     */

    @Select("SELECT o.* FROM  zyg_hospital_pay_order o "
            + "LEFT JOIN zyg_hospital_pay_order_detail d on d.pay_order_id=o.pay_order_id "
            + "WHERE o.state=2 and d.business_order_id=#{businessId}  GROUP BY o.pay_order_id")
    GptPayOrder getPayPrepayByBusinessIdId(@Param("businessId") Long businessId);
}
